﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using LGSVR.Common;


namespace LGSVR.BLL.Terminal
{
    public class CardGroupAreaBLL
    {
        public DataTable GetCardGroupAreaByGroupID(string groupID)
        {
            string sql = "select ROW_NUMBER() over(order by id) as RowID,* from CardGroupArea    ";
            if (groupID != "")
            {
                sql += " where groupID=@groupID";
            }
            List<SqlParameter> lstParam = new List<SqlParameter>();
            lstParam.Add(new SqlParameter("@groupID", groupID));
            DataTable dt = SQLHelper.GetDataTable(sql, CommandType.Text, lstParam.ToArray());
            return dt;
        }

        public int DeleteByGroupID(string groupID)
        {
            string sql = "delete CardGroupArea where groupID=@groupID";
            List<SqlParameter> lstParam = new List<SqlParameter>();
            lstParam.Add(new SqlParameter("@groupID", groupID));
            int i = SQLHelper.ExecuteNonQuery(sql, CommandType.Text, lstParam.ToArray());
            return i;
        }
    }
}
